using System;
using System.ComponentModel.DataAnnotations;
using Framework.SqlDataAccess.Model;

namespace Kaysite.Model
{
    public class Article : KaysiteModel
    {
        [DBMaping(PrimaryKey = true)]
        [Required]
        public int ArticleID { get; set; }

        [DBMaping]
        [Required]
        public DateTime OnDate { get; set; }

        [DBMaping]
        [Required]
        public eArticleType ArticleTypeID { get; set; }

        [DBMaping]
        [Required]
        [StringLength(512)]
        [DBFieldInfo(IsName = true)]
        public string Title { get; set; }

        [DBMaping]
        [Required]
        public string ShortDescription { get; set; }

        [DBMaping]
        [Required]
        public string Description { get; set; }

        [DBMaping]
        public byte[] CoverImage { get; set; }

        [DBMaping]
        [Required]
        public eArticleStatus StatusID { get; set; }

        [DBMaping]
        public int? ArticleGroupID { get; set; }

        [DBMaping]
        [Required]
        public eDisplayOption DisplayInMain { get; set; }

        public string Status
        {
            get
            {
                return StatusID.GetName();
            }
        }
        
        public Article()
        {
            ArticleTypeID = eArticleType.Article;
            StatusID = eArticleStatus.Draft;
            DisplayInMain = eDisplayOption.Hide;
        }
    }
}